import axios from 'axios';
import { ALL_SERVICE_API } from '../api';
var qs = require('qs');
// 领头羊列表
export const searchTruckBellwetherList = params => {
  return axios.get(ALL_SERVICE_API + '/truck-bellwethers', {params: params});
};

// 根据ID获取领头羊信息
export const getTruckBellwetherById = (id) => {
  return axios.get(ALL_SERVICE_API + '/truck-bellwethers/' + id);
};

// 新增领头羊
export const saveTruckBellwether = (params) => {
  return axios.post(ALL_SERVICE_API + '/truck-bellwethers', params);
};

// 修改领头羊信息
export const updateTruckBellwether = (id, params) => {
  return axios.post(ALL_SERVICE_API + '/truck-bellwethers/' + id, params);
};

// 修改领头羊状态（启用/停用）
export const modifyTruckBellwetherStatus = (id, status) => {
  return axios.post(ALL_SERVICE_API + '/truck-bellwethers/status', qs.stringify({id: id, status: status}));
};

// 根据ID删除领头羊
export const deleteInfoById = (id) => {
  return axios.delete(ALL_SERVICE_API + '/truck-bellwethers/' + id);
};

// 领头羊列表运力池查询
export const searchTruckBellwetherDriverList = params => {
  return axios.get(ALL_SERVICE_API + '/truck-bellwether-drivers', {params: params});
};

// 领头羊线路列表查询
export const searchTruckBellwetherLinesList = params => {
  return axios.get(ALL_SERVICE_API + '/truck-bellwether-lines', {params: params});
};

// 领头羊线路-新增 truck-bellwether-lines-batch
export const saveTruckBellwetherLines = (params) => {
  return axios.post(ALL_SERVICE_API + '/truck-bellwether-lines-batch', params);
  // return axios.post(ALL_SERVICE_API + '/truck-bellwether-lines', params);
};

// 根据ID删除领头羊线路
export const deleteInfoLinesById = (id) => {
  return axios.delete(ALL_SERVICE_API + '/truck-bellwether-lines/' + id);
};

// 领头羊辐射范围列表查询
export const searchTruckBellwetherScopeList = params => {
  return axios.get(ALL_SERVICE_API + '/truck-bellwether-radiation-cities', {params: params});
};

// 领头羊辐射范围-批量新增（始发-目的城市字段--startAddrIds,endAddrIds）
export const saveTruckBellwetherScope = (params) => {
  return axios.post(ALL_SERVICE_API + '/truck-bellwether-radiation-cities', params);
};

// 根据ID删除领头羊辐射范围（多个逗号隔开）
export const deleteInfoScopesById = (id) => {
  return axios.delete(ALL_SERVICE_API + '/truck-bellwether-radiation-cities/' + id);
};

// 领头羊线路管理列表查询
export const searchTruckBellwetherLinesListManage = params => {
  return axios.get(ALL_SERVICE_API + '/truck-bellwether-lines-manage', {params: params});
};

// 领头羊辐射范围管理列表查询
export const searchTruckBellwetherScopeListManage = params => {
  return axios.get(ALL_SERVICE_API + '/truck-bellwether-radiation-cities-manage', {params: params});
};
